package com.lcm.basic.p7.set;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @author Coder-lcm
 * @date 2021/4/3
 *
 *      LinkHashSet: 是按插入的顺序排列的，基于链表（LinkedHashMap）实现
 */
public class SetDemo2ForLinkedHashSet {
    public static void main(String[] args) {
        Set books = new LinkedHashSet();
        books.add("dsadsada");
        books.add("dsadsasdasd");
        books.add("Dadad");
        books.forEach(e -> {
            System.out.println(e);  //[dsadsada dsadsasdasd Dadad]
        });

        books.remove("dsadsasdasd");
        books.add("dsadsasdasd");
        books.forEach(e -> {
            System.out.println(e);  //[dsadsada Dadad dsadsasdasd]
        });

    }
}
